/*
 * @Author: zyk 997610780@qq.com
 * @Date: 2022-10-19 11:15:46
 * @LastEditors: zyk 997610780@qq.com
 * @LastEditTime: 2022-10-19 12:29:43
 * @FilePath: \fifty-small-projects\43用户反馈界面\43.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
let app_box = document.getElementById('app')
let eln_list = document.querySelectorAll('.eln')
let main_box = document.querySelector('.main')
let sub_btn = document.querySelector('.main_ft')

eln_list.forEach(eln => {
  eln.addEventListener('click', () => {
    eln_list.forEach(el => el.classList.remove('active'))
    eln.classList.add('active')
  })
})


sub_btn.addEventListener('click', () => {
  main_box.classList.add('hide')
  let result = ''
  eln_list.forEach(item=>{
    if(item.classList.contains('active')){
      result = item.innerText
    }
  })
  setTimeout(() => {
    main_box.remove()
    app_box.appendChild(createResult(result))
  }, 2000)
})


function createResult(feedback_result) {
  let div = document.createElement('div')
  div.classList.add('result')
  div.innerHTML = `
    <div class="result_title">
      <i class="custom-icon custom-icon-aixin"></i>
      <span class="thank_text">Thank You!</span>
    </div>
    <div class="result_an">反馈结果：${feedback_result}</div>
    <div class="ps">我们将利用您的反馈改进对客户的支持</div>
  `
  return div
}
